#!/bin/bash

# sudo apt install -y gcc g++ git cmake ninja-build
# sudo apt install -y gcc-9 g++-9
# git clone https://github.com/llvm/llvm-project.git

# BUILD_TYPE=Release
BUILD_TYPE=Debug
PREFIX_DIR=/home/zzy/llvm-10.0.0/bin

cd llvm-project
git checkout -b llvmorg-10.0.0 llvmorg-10.0.0
rm -rf build && mkdir build
cd build

# using gcc-9/g++-9
cmake -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang" \
	-DCMAKE_INSTALL_PREFIX=${PREFIX_DIR} -DCMAKE_C_COMPILER=/usr/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/bin/g++-9 ../llvm
ninja -j16
# ninja check-all
# ninja install
